package us.gaaoc.framework.util.pdf.regexp;

import us.gaaoc.framework.model.Court;

/**
 * This is a frontend class for pulling regular expression information from the database.
 * The current implementation uses hardcoded values but in the future
 * it will be replaced by database tables and associations.
 * @author artripa
 *
 */
public class DocumentRegexps {

	//TODO: move to database table.
	

	//public static final String CourtUuid3_SHOW_CAUSE_COURT_DATE = " .m. on the \\~({COURT_DAY}____) day of\\*({COURT_MONTH_YEAR}.*), 2008";
	//Defendant is hereby summoned to appear before this Court at ^______ .m. on the ~_____ day of *_______________________ in Superior Courtroom #______ at the Douglas
    //Defendant is hereby summoned to appear before this Court at ^__________ on the ~_______ day of
    //*_____________________ in Superior Courtroom #____ at the Douglas 

	
	//public static final String CourtUuid3_SHOW_CAUSE = "Defendant is hereby summoned to appear before this Court at \\^({COURT_TIME}__________) on the ~({COURT_DAY}_______) day of .({COURT_MONTH_YEAR}_____________________) in Superior Courtroom #({COURT_ROOM}____) at the Douglas";
	//public static final String CourtUuid3_SHOW_CAUSE_COURT_ROOM = "#({COURT_ROOM}____) at the Douglas County Courthouse";

	public static final String CourtUuid3_SHOW_CAUSE = "Defendant +is +hereby +summoned +to +appear +before +this +Court +at +\\^*({COURT_TIME}_+) +on +the ~({COURT_DAY}_+) +day +of +.({COURT_MONTH_YEAR}_+) +in +Superior +Courtroom #({COURT_ROOM}_+) +at +the +Douglas";
	public static final String CourtUuid3_SUMMONS_AND_RULE_NISI = "County +at +\\^*({COURT_TIME}_+) +on +the +.({COURT_DAY}_+) +day +of +.({COURT_MONTH_YEAR}_+).*Room #({COURT_ROOM}_+) +on +the +F";
	//County at ^_____ o'clock on the ~____ day of *__________, 2008  in the Douglas County Courthouse located at 8700 Hospital Drive, Douglasville, Georgia  30134 Room #_____

	//TODO: move to database table
	//temporary placeholders for many to many visualmarkcategories for regexp stamps.
	public static final int COURT_DATE = 1;
	public static final int COURT_MONTH = 2;
	public static final int COURT_DAY = 3;
	public static final int COURT_YEAR = 4;	
	public static final int COURT_TIME = 5;
	public static final int COURT_ROOM = 6;
	public static final int COURT_META_DATA = 7;
	public static final int FIND_COURT_STAMP = 8;
	public static final int FIND_CVNUMVER_STAMP = 9;
	public static final int SIGN_DATE = 10;
	public static final int BARID_STAMP = 11;

	public static String CourtUuid3_SIGN_DATE = ".his the ({SIGN_DAY}_+) day of ({SIGN_MONTH_YEAR}_+)";
	public static String findCVNumberStampRaw = "CV:\\d\\d[A-Z][A-Z]\\d+";
	public static String findCourtStampRaw = "(CLERK'S OFFICE)Tj\\n\\d+\\.*\\d* \\d+\\.*\\d* \\d+\\.*\\d* \\d+\\.*\\d* \\d+\\.*\\d* \\d+\\.*\\d* Tm\\n\\)(\\w\\+\\)\\-\\d\\+\\-\\d\\d\\d\\d)Tj";
	public static String Attorney_BARID = "State Bar No.: ({BARID}_+)";

	public static String getCourtRegexp(Court c,int type)
	{
		return getCourtRegexp(c.getUuid(),type);
	}
	
	public static String getCourtRegexp(String courtUuid,int type)
	{
		if(type == FIND_COURT_STAMP)
		{
			return findCourtStampRaw;
		}
		if(type ==FIND_CVNUMVER_STAMP)
		{
			return findCVNumberStampRaw;
		}
		return"";
	}
	
	
	public static String getRegexp(int code, int regexpType)
	{		
		
		if(regexpType == SIGN_DATE)
		{
			return CourtUuid3_SIGN_DATE;
		}
		
		if(regexpType == BARID_STAMP)
		{
			return Attorney_BARID;
		}
		
		if(code == 197){
			return CourtUuid3_SUMMONS_AND_RULE_NISI;
		}else if(code == 196)
		{		
			return CourtUuid3_SHOW_CAUSE;
		}
		
		
		return null;
	}
	
}
